<script src="../asynx.js"></script>
<script src="../dom/dom.js"></script>
<script src="../impl/array.js"></script>
<script src="../impl/util.js"></script>
<script src="../impl/cookie.js"></script>
<script src="../impl/ajax.js"></script>
<script src="../impl/lang.js"></script>
<script src="../dom/xpath.js"></script>
<script src="../dom/selector.js"></script>
<script src="../event/event.js"></script>

<script src="../plugins/drag/drag.js"></script>
<script src="../plugins/animation/anim.js"></script>
<script src="../plugins/datalist/datalist.js"></script>



<div id="titulo">asynx AJAX Connector</div><br>
<div id="log">LOG<br></div>

<form name="teste" action="blkahhhh.html" target="" method="post" enctype="multipart/form-data">
	
	<input type="file" name="foto">
	<input type="hidden" name="sssfoto" value="sdasd">
	<textarea name="texto"></textarea>
	
	<input type="button" value="Enviar" onclick="_submit();">
	<input type="button" value="Enviar" onclick="a();">
	
</form>

<script>

asynx.event.onLoad(function() {
	
	log(asynx.serializeForm('//form[@name="teste"]'))
});


function _submit() {
	
	var attr = {
		
		url:'submit.php',
		
		onComplete: function(r, args) {
			//asynx$('log').appendln(r);
			alert(r)
		}
	};
	
	var ajax = new asynx.ajax(attr);
	ajax.submit(asynx$('//form[@name="teste"]'), false);
	ajax.addValue("foo1", "bar1");
	ajax.addValue("foo2", "bar2");
	ajax.addValue("foto", "fotofotofoto");
	ajax.load();
}

//asynx.$open("ajax.php", null, function(r,a){alert(r)});
//asynx.$getScript("script.js", null, function(j,a) {alert(j+"-"+a)}, "abc");
//asynx.$getJSON("ex.json", null, function(j,a) {alert(j+"-"+a)}, "abc");


asynx$("log").openUrl("ajax.php", {nome:"joao"});


function a() {
	asynx.$ifUpdated("teste.xml", { foo:"bar" }, function(r, args) {
		alert(r + " : " + args)
	},
	
	"onCompleteArgs",

	function(args) {
		alert(args)
	},
	
	"ifModifiedArgs");
}

asynx("//input").each(function(n){
	n.style.backgroundColor = '#ccc';
});

</script>